public class MathTest {
    public static void main(String[] args) {
        //了解math类提供的常见方法

        //取绝对值   abs

        System.out.println(Math.abs(-12));
        System.out.println(Math.abs(123));
        System.out.println(Math.abs(-3.14));

        //向上取整    ceil
        System.out.println(Math.ceil(4.0000001));
        System.out.println(Math.ceil(4.0));

        //向下取整   floor
        System.out.println(Math.floor(4.999999));

        //四舍五入   round
        System.out.println(Math.round(5.40));
        System.out.println(Math.round(5.50));
        System.out.println(Math.round(5.44));
        System.out.println(Math.round(5.55));

        //取较大值   max
        System.out.println(Math.max(1, 2));

        //取较小值   min
        System.out.println(Math.min(10, 20));

        //取次方     pow
        System.out.println(Math.pow(2, 3));

        //random 取随机数 [0.0 , 1.0)(包前不包后)
        System.out.println(Math.random());

    }
}
